Skip to content

bindspace→mailbox_soa migration: W0 dependency map + W1 small-column migration (additive, parity-tested)#517

Merged
AdaWorldAPI merged 3 commits into
mainfrom
claude/bindspace-mailbox-soa-migration
Jun 17, 2026
Merged

bindspace→mailbox_soa migration: W0 dependency map + W1 small-column migration (additive, parity-tested)#517
AdaWorldAPI merged 3 commits into
mainfrom
claude/bindspace-mailbox-soa-migration

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Jun 17, 2026

Copy link
Copy Markdown
Owner

What

Opens the bindspace → mailbox_soa migration arc. This PR is W0 (dependency map) + W1 (first additive column migration) — strictly additive, parity-tested, nothing deleted. The singleton BindSpace is fully intact; both paths run.

Operator constraints honored: the replacement is a given; two parallel paths, step by step — the old is never deleted before the new is tested; map the dependencies before wiring; CausalEdge64 duplication handled precisely, no handwaving.

W0 — dependency map / wiring preflight (.claude/plans/bindspace-mailbox-soa-dependency-map-v1.md)

Read-based (full reads of every critical-path consumer + two Opus inventory agents for the rest), produced before any wiring:

  • CausalEdge64 duplication, mapped exactly: causal_edge::edge::CausalEdge64 (the SPO/thinking baton — the EdgeColumn, used everywhere) vs ndarray::hpc::causal_diff::CausalEdge64 (a weight-diff codec — never imported into lance-graph, 0 sites). Both #[repr(transparent)] over u64 with public .0 and overlapping method names of incompatible semantics ⇒ the hazard is purely u64-level. The contract's raw-u64 MailboxSoaView::edges_raw() is the firewall (keeps the contract zero-dep); typed reattach lives at exactly two trusted boundaries (MailboxSoA owner via the const-asserted repr(transparent) cast + p64-bridge). Rule locked: the ndarray twin is barred from the baton path. v2 layout drops temporal ⇒ it stays a standalone column.
  • The cold path is already built: surreal_container::SurrealMailboxView already implements MailboxSoaView (read-only, raw u64); LanceVersionScheduler is generic over it; the driver already holds both bindspace and a mailboxes map (the two-path cradle).
  • Hazards pinned: the 4× Arc::get_mut(&mut bindspace) single-owner sites; attention_mask* is a separate AttentionMaskSoA (must not conflate); cycle/Vsa16kF32 never migrates; content/topic/angle stay hot (OQ-1 resolved §2.7). The 2 BindSpace::zeros(4096) bin construction sites.
  • W0–W7 delete-last sequence with parity test (W1) → differential dispatch test (W2) → feature-gated engine_bridge + dispatch swap (W3/W4) → bins (W5) → tombstone (W6) → delete BindSpace LAST (W7).

W1 — migrate the small columns (temporal / expert / sigma)

  • MailboxSoA<N> gains temporal: [u64;N], expert: [u16;N], sigma: [u8;N] + accessors + reset_row coverage.
    • temporal is a standalone column, not folded into the edge (the v2 CausalEdge64 reclaimed those bits — I-LEGACY-API-FEATURE-GATED).
    • sigma is a Σ-codebook index (a reference, not content — I-VSA-IDENTITIES; the codebook stays shared/cold).
  • Parity test test_mailbox_soa_column_parity_with_bindspace: writes matched per-row values to a BindSpace window and a MailboxSoA, then asserts edges / qualia / meta / entity_type (D-MBX-A1) + temporal / expert / sigma (W1) read back identically. This is the "test the new before deleting the old" proof.

Tests

13 mailbox_soa tests green (parity test included); clippy -p cognitive-shader-driver --lib clean. No dispatch path touched; BindSpace untouched.

Next (not in this PR)

W1b — the dense content/topic/angle hot identity planes (the driver's resonance read; heap Box<[u64]>, cycle excluded). Then W2–W7 per the map. Each step stays two-path and delete-last.

🤖 Generated with Claude Code


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Added three new columns to the MailboxSoA structure with dedicated read/write accessors for row-level data access.
  • Tests

    • Added a parity verification test between two data structures.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@AdaWorldAPI, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 52 minutes and 44 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 65938494-c3eb-4360-ab48-bc98459e1fc1

📥 Commits

Reviewing files that changed from the base of the PR and between 9ddca83 and fc7849c.

📒 Files selected for processing (2)
  • .claude/plans/bindspace-mailbox-soa-dependency-map-v1.md
  • crates/cognitive-shader-driver/src/mailbox_soa.rs
📝 Walkthrough

Walkthrough

Adds three new D-MBX-A2 per-row columns (temporal: [u64; N], expert: [u16; N], sigma: [u8; N]) to MailboxSoA, with zero-init in new(), clearing in reset_row(), six public accessors, and a column-parity unit test against BindSpace. A planning document is also added that maps all BindSpace columns to MailboxSoA, records the CausalEdge64 firewall rules, consumer hotspots, and a W0–W7 wiring sequence.

Changes

MailboxSoA D-MBX-A2 columns and migration preflight

Layer / File(s) Summary
D-MBX-A2 struct fields, init, reset, accessors, and parity test
crates/cognitive-shader-driver/src/mailbox_soa.rs
Adds temporal, expert, and sigma array fields to MailboxSoA<N>, extends new() and reset_row() to zero them, adds six public getter/setter methods, and introduces test_mailbox_soa_column_parity_with_bindspace to assert mirrored values across both stores.
BindSpace→MailboxSoA migration preflight doc
.claude/plans/bindspace-mailbox-soa-dependency-map-v1.md
Records the full column mapping table, CausalEdge64 raw-u64 firewall and v2 temporal gating rules, consumer dependency hotspots, Arc::get_mut singleton hazards, the W0–W7 two-path wiring sequence with parity checkpoints, and a consolidated dedup-hazards checklist.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • AdaWorldAPI/lance-graph#427: Adds the earlier A1 thoughtspace columns to MailboxSoA using the same new()/reset_row()/accessor pattern that this PR extends for A2.
  • AdaWorldAPI/lance-graph#487: Prior MailboxSoA contract/semantics refactor that the current A2 column additions build directly on top of.

Poem

🐇 Hop, hop — three new columns arrive in a row,
temporal, expert, and sigma aglow.
The mailbox grows wider, the map shows the way,
W0 through W7, a well-ordered day.
No old path deleted until the new's proven right—
A careful migration, done bunny-style, tight! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and clearly describes the main changes: initiating the bindspace→mailbox_soa migration with W0 (dependency map) and W1 (small-column migration). It is specific, concise, and directly maps to the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
crates/cognitive-shader-driver/src/mailbox_soa.rs (1)

826-899: ⚡ Quick win

Add a focused reset test for the new A2 columns.

The parity test is solid, but it does not verify reset_row() clears temporal/expert/sigma. A small targeted test will protect migration invariants against regressions.

Suggested test addition
+    #[test]
+    fn test_mailbox_soa_reset_row_clears_a2_columns() {
+        let mut mb: MailboxSoA<4> = MailboxSoA::new(1, 0, 1.0);
+        mb.set_temporal(2, 123);
+        mb.set_expert(2, 77);
+        mb.set_sigma(2, 9);
+
+        mb.reset_row(2);
+
+        assert_eq!(mb.temporal_at(2), 0, "temporal[2] must reset to 0");
+        assert_eq!(mb.expert_at(2), 0, "expert[2] must reset to 0");
+        assert_eq!(mb.sigma_at(2), 0, "sigma[2] must reset to 0");
+    }

As per coding guidelines, "crates/**/*.rs: Add Rust unit tests alongside implementations via #[cfg(test)] modules; prefer focused scenarios over broad integration tests."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/cognitive-shader-driver/src/mailbox_soa.rs` around lines 826 - 899,
The parity test test_mailbox_soa_column_parity_with_bindspace() verifies that
temporal, expert, and sigma values are correctly set and retrieved, but it does
not validate that the reset_row() method clears these new A2 columns. Add a new
focused unit test with the #[test] attribute in the same module that
specifically tests the reset_row() behavior for the A2 columns by setting values
for temporal, expert, and sigma in a MailboxSoA instance, calling reset_row() on
specific rows, and then asserting that these fields return to their default/zero
state to protect against migration invariants regressions.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/plans/bindspace-mailbox-soa-dependency-map-v1.md:
- Around line 27-32: The document contains contradictory status markers for
three columns: fingerprints.sigma, temporal, and expert are marked as **GAP** in
the A2-gap mapping table (around lines 27-32, 43-44, and 143-148), but the W1
"DONE" section indicates these columns are already shipped. Locate the W1 "DONE"
section to verify the actual shipping status of these three columns, then update
all occurrences of their status markers in the earlier A2-gap sections from
**GAP** to **SHIPPED** (or whatever status marker is used in the W1 section) to
resolve the contradiction and keep migration tracking consistent throughout the
document.

---

Nitpick comments:
In `@crates/cognitive-shader-driver/src/mailbox_soa.rs`:
- Around line 826-899: The parity test
test_mailbox_soa_column_parity_with_bindspace() verifies that temporal, expert,
and sigma values are correctly set and retrieved, but it does not validate that
the reset_row() method clears these new A2 columns. Add a new focused unit test
with the #[test] attribute in the same module that specifically tests the
reset_row() behavior for the A2 columns by setting values for temporal, expert,
and sigma in a MailboxSoA instance, calling reset_row() on specific rows, and
then asserting that these fields return to their default/zero state to protect
against migration invariants regressions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 077474ba-206e-42d5-844b-3d4b29fe79f6

📥 Commits

Reviewing files that changed from the base of the PR and between e33cdf7 and 9ddca83.

📒 Files selected for processing (2)
  • .claude/plans/bindspace-mailbox-soa-dependency-map-v1.md
  • crates/cognitive-shader-driver/src/mailbox_soa.rs

Comment thread .claude/plans/bindspace-mailbox-soa-dependency-map-v1.md Outdated
claude added 3 commits June 17, 2026 12:48
…eflight

Read-based map (full reads of every critical-path consumer + two Opus inventory
agents for the rest) produced BEFORE any wiring, per operator directive ("map
the many dependencies before"; "two paths step by step, never delete the old
before testing the new"; "CausalEdge64 is duplicated — no handwaving").

Contents:
- §0 the two stores side by side; the D-MBX-A2 gap (content/topic/angle dense
  hot per OQ-1-resolved, sigma, temporal, expert); cycle (Vsa16kF32) = DROP.
- §1 the CausalEdge64 duplication mapped exactly: causal_edge::edge (SPO baton,
  used everywhere) vs ndarray::hpc::causal_diff (weight-diff codec, NEVER
  imported into lance-graph). Both repr(transparent)/u64 → silent-corruption
  hazard at the u64 level. The contract's raw-u64 edges_raw() is the firewall;
  typed reattach only at MailboxSoA owner + p64-bridge. v2 layout drops temporal.
- §2 consumer map: column hot-spots (engine_bridge + driver), the 2 bin
  construction sites, the 4 Arc::get_mut single-owner hazards, the singleton-
  bound tests, and the ALREADY-built cold side (surreal_container
  SurrealMailboxView impls MailboxSoaView; scheduler generic over it; the
  driver already holds both bindspace + mailboxes).
- §3 W0–W7 delete-last wiring sequence (parity test W1, differential test W2,
  feature-gated engine_bridge/dispatch swap W3/W4, bins W5, tombstone W6,
  delete BindSpace LAST W7).
- §4 dedup hazards checklist.

No source wired. Branch off main (post-#516), independent of the open #515.

Co-Authored-By: Claude <noreply@anthropic.com>
…ve, parity-tested)

First wiring step of the bindspace→mailbox_soa arc. ADDITIVE only — the singleton
BindSpace is untouched; nothing deleted (operator: "two paths step by step,
never delete the old before testing the new").

- MailboxSoA<N> gains temporal: [u64;N], expert: [u16;N], sigma: [u8;N] (the
  D-MBX-A2 small columns) + accessors (temporal_at/set_temporal/…) + reset_row.
  temporal is a standalone column NOT folded into the edge: the v2 CausalEdge64
  layout dropped temporal bits (I-LEGACY-API-FEATURE-GATED). sigma is a Σ-codebook
  index (reference, not content; I-VSA-IDENTITIES).
- test_mailbox_soa_column_parity_with_bindspace: writes matched per-row values to
  a BindSpace window and a MailboxSoA, asserts edges/qualia/meta/entity_type +
  temporal/expert/sigma read back identically. The "test the new" proof.
- 13 mailbox_soa tests green, clippy clean.

W1b (dense content/topic/angle hot planes — the driver's resonance read) is the
next step; the cycle (Vsa16kF32) plane is never migrated (OQ-1/§2.7).
Dependency map + W0–W7 sequence: bindspace-mailbox-soa-dependency-map-v1.md.

Co-Authored-By: Claude <noreply@anthropic.com>
CodeRabbit review on #517, both valid:
- doc: sigma/temporal/expert were marked **GAP** in the §0 mapping table while
  the W1 DONE section said shipped — contradiction. Updated the three rows to
  **SHIPPED (W1)** and the "remaining D-MBX-A2 gap" line to content/topic/angle
  only (the W1b heap planes).
- test: added test_mailbox_soa_reset_row_clears_a2_columns — reset_row() must
  clear the new temporal/expert/sigma columns (migration-invariant regression
  guard). 14 mailbox_soa tests green.

Also rebased onto post-#515 main (e063416) so W1b will wire against the merged
driver (which now carries the MaterializeProvenance provenance wire).

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants